import { getMaymesg } from "@/api/api";
export default {
  name: 'order',
  components: {}, 
  props: [],
  data () {
    return {
      input:"",
      
       tableData6: [{
          id: '12987122',
          name: '王小虎',
          amount1: '234',
          amount2: '3.2',
          amount3: 10
        }],
         payWay: 0,// 0 款到发货, 1 线下支付
      sendWay: 0, // 0 配送 ,1 自提
      spendWay: 0,// 0 一票制 ,1 二票制
       dialogTableVisible1: false,
      dialogFormVisible1: false,
      dialogTableVisible2: false,
      dialogFormVisible2: false,
      dialogTableVisible3: false,
      dialogFormVisible3: false,
      dialogTableVisible4: false,
      dialogFormVisible4: false,
      form: {
        name: '',
        phone: '',
        desc: ''
      },
      formLabelWidth: '120px',
    }
  },
  computed: {

  },
  created () {
    this._getMaymesg()
  },
  mounted () {

  },
  methods: {
    _getMaymesg(){
      let params={
        params:{}
      }
      getMaymesg(params).then((res)=>{
        console.log(res)
      })
    },
     arraySpanMethod({ row, column, rowIndex, columnIndex }) {
        if (rowIndex % 2 === 1) {
          if (columnIndex === 1) {
            return [1, 2];
          } else if (columnIndex === 0) {
            return [0, 0];
          }
        }
      },
      changeWay(type, num) {
      this[type] = num;
    },
      // 修改地址判断不为空
    modify: function () {
      var order_span1 = $(".order_span1");
      var order_span2 = $(".order_span2");
      var order_span3 = $(".order_span3");
      var order_span4 = $(".order_span4");

      if (this.form.name == "") {
        order_span1.text("*收货人不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span1.text("");
      }
      if (this.form.phone == "") {
        order_span2.text("*联系电话不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span2.text("");
      }
      if (this.form.region == "") {
        order_span3.text("*省份不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span3.text("");
      }
      if (this.form.desc == "") {
        order_span4.text("*详细地址不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span4.text("");
      }

      this.dialogFormVisible1 = false;
    },
    orderClick: function (index) {
      if (index == "1") {
        $(".adress_list_card").css({ "color": "#333333", "border": "1px solid #cccccc", });
        $(".adress_list_card1").css({ "color": "#00a0e9", "border": "1px solid #00a0e9", })
      } else if (index == "2") {
        $(".adress_list_card").css({ "color": "#333333", "border": "1px solid #cccccc", });
        $(".adress_list_card2").css({ "color": "#00a0e9", "border": "1px solid #00a0e9", })
      } else if (index == "3") {
        $(".adress_list_card").css({ "color": "#333333", "border": "1px solid #cccccc", });
        $(".adress_list_card3").css({ "color": "#00a0e9", "border": "1px solid #00a0e9", })
      }
    },
    open2() {
        this.$alert('这是一段内容', '新增收货地址', {
          confirmButtonText: '确定',
          callback: action => {
            this.$message({
              type: 'info',
              message: `action: ${ action }`
            });
          }
        });
      },
      // 修改地址判断不为空
    modify: function () {
      var order_span1 = $(".order_span1");
      var order_span2 = $(".order_span2");
      var order_span3 = $(".order_span3");
      var order_span4 = $(".order_span4");

      if (this.form.name == "") {
        order_span1.text("*收货人不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span1.text("");
      }
      if (this.form.phone == "") {
        order_span2.text("*联系电话不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span2.text("");
      }
      if (this.form.region == "") {
        order_span3.text("*省份不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span3.text("");
      }
      if (this.form.desc == "") {
        order_span4.text("*详细地址不能为空!");
        return this.dialogFormVisible1 = true;
      } else {
        order_span4.text("");
      }

      this.dialogFormVisible1 = false;
    },
  }
}
